package edu.zut.cs.javaee.manager.teacher;

import edu.zut.cs.javaee.manager.teacher.dao.TeacherDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

/**
 * @author fy
 * teacher service
 */
@Service
@Transactional
public class TeacherService {
    @Autowired
    private TeacherDao teacherDao;

    /**
     * 判断姓名密码
     * @param userName
     * @param passWord
     * @return
     */
    public List getUserInfo(String userName, String passWord) {
        return teacherDao.findList("from Teacher where userName = ?0 and password = ?1",userName,passWord);
    }

    /**
     *查找id和真实姓名
     * @return
     */
    public List<Map<String, Object>> getTeacherNameAndId() {
        return teacherDao.findListBySqlNoEntity("select id,realName from teacher");
    }
}
